package table.creators;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import controllers.AuthorHelper;
import models.Accident;
import models.Vehicle;
import models.Driver;
import controllers.Helper;
import controllers.TableModel;
import controllers.TableModel.AoColum;

public class AccidentTable {

    public static TableModel create(String current_user) {
    
        final String title = "事故记录";
        String today = Helper.dateToString(new Date());
        String now = Helper.datetimeToString(new Date());

        List<AoColum> colums = new ArrayList<AoColum>();
        TableModel model = new TableModel();

        //                           name,             title,         required,     defaut,        cansearch, editable,    edit_type,    edit_data,            editable_settings    
        if(true) {
           colums.add(model.new AoColum("id",    "编号",    false,    "",    false,    false,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("vehicle_our.plate_number",    "车号",    true,    "",    true,    true,    "select",    Vehicle.getPlate_numberJson(),    null,  "ONEBOX",  "vehicle",  "plate_number",  "insurance",  "vehicle.plate_number",  "driver.name",  "driver_our.name",  false));
        }
        if(true) {
           colums.add(model.new AoColum("driver_our.name",    "我方驾驶员",    true,    "",    false,    true,    "select",    Driver.getNameJson(),    null,  "ONEBOX",  "driver",  "name",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("accidentdatetime",    "事故发生时间",    true,    now,    true,    true,    "datetime",    null,    null,  "TWOBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("reporter",    "接报人",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("recorddatetime",    "登记时间",    true,    now,    true,    true,    "datetime",    null,    null,  "TWOBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("place",    "事故地点",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("response",    "事故现场定责",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("damage",    "我方受损情况",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("driver2",    "对方驾驶员",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("plate_number2",    "车号",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("xszh",    "行驶证号",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("jzh",    "驾证号",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("damage2",    "受损情况",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("story",    "事故发生原因及经过",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("policecomment",    "事故发生所在地交警意见",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("handover",    "事故处理交接情况",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("accidenttype",    "事故性质",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("death",    "伤亡人数",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("fee",    "事故总支出",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("insurance",    "保险理赔",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("companypay",    "公司支付",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("personalpay",    "个人支付",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("commpanylost",    "公司损失",    true,    "0",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        if(true) {
           colums.add(model.new AoColum("comment",    "备注",    true,    "",    false,    true,    "edit",    null,    null,  "ONEBOX",  "",  "",  "",  "",  "",  "",  false));
        }
        model.buildModel(Accident.class, 600, title, AuthorHelper.canDo(current_user, title, "增加"), AuthorHelper.canDo(current_user, title, "搜索"), AuthorHelper.canDo(current_user, title, "删除"), colums);
        return model;
    }
}

